package com.mdoya.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mdoya.domain.OrderDetail;
import com.mdoya.mapper.OrderDetailMapper;
import com.mdoya.service.OrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author mdoya
 * @version 1.0
 * @description:
 */
@Scope("singleton")
@Transactional(propagation = Propagation.REQUIRED)
@Service
public class OrderDetailServiceImpl implements OrderDetailService {
    @Autowired
    private OrderDetailMapper orderDetailMapper;
    /**
     * 订单id查询订单详情
     *
     * @param orderId
     * @return
     */
    @Override
    public List<OrderDetail> findOrderId(Long orderId) {
        LambdaQueryWrapper<OrderDetail> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(orderId != null, OrderDetail::getOrderId, orderId);
        return orderDetailMapper.selectList(queryWrapper);
    }
}
